<?php

/**
 * Class Lw_db 通用类，使用于常用的增删改查操作
 */

class Lw_emails
{
    protected $CI;

    public function __construct()
    {
        $this->CI =& get_instance();
        $this->CI->load->library('email');
    }

    public function send($toEmail)
    {
        $config['protocol'] = 'smtp';
        $config['smtp_host'] = 'ssl://smtp.qq.com';
        $config['smtp_user'] = '1023953303@qq.com';
        $config['smtp_pass'] = 'vqdiaesoknwnbedc';//去QQ邮箱设置开启smtp
        $config['smtp_port'] = 465;
        $config['smtp_timeout'] = 30;
        $config['mailtype'] = 'text';
        $config['charset'] = 'utf-8';
        $config['wordwrap'] = TRUE;
        $this->CI->email->initialize($config);
        $this->CI->email->set_newline("\r\n");
        $config['crlf'] = "\r\n";
        $this->CI->email->from('1023953303@qq.com', '云阅书城');
        $this->CI->email->to($toEmail);

        $this->CI->email->subject('刘小白占小胖工作室【官方邮箱】');
        $this->CI->email->message('这是一个正式的邀请函：邀请占小胖前往工作室工作。');
        // 附件
        $this->CI->email->attach('http://imglf0.nosdn.127.net/img/eWJ0MnNyZG03RXQycVNUUkdER3N2ME1jTzR4eHFmOEQzTXJjK3BXMzE4bmNDdk9Za0ZsWHhnPT0.jpg');
        $this->CI->email->send();
        return $this->CI->email->print_debugger();
    }

}